" vim: ft=vim
" Test dir()
"
Execute(Only accept Dict);
let input = [
      \ 1,
      \ 'str',
      \ [],
      \ ]

for x in input
  AssertThrows call object#dir(g:x)
  Assert g:vader_exception =~# 'WrongType'
endfor

Execute(Return keys() for ordinary Dict);
let x = {
      \ 'root': '/path/to/somewhere/',
      \ 'has_permisson': 'true',
      \ 'last_access': '/path/to/somefile',
      \ 'refcnt': 10,
      \ }

AssertEqual keys(x), object#dir(x), 'if the Dict has no __dir__(), use key()'


Execute(hooks into __dir__());
let cls = {
      \ 'x': []
      \ }
function! cls.__dir__()
  return self.x
endfunction

AssertEqual [], object#dir(cls)
